//
//  RecommenCollectionViewCell.m
//  礼物
//
//  Created by dllo on 15/11/11.
//  Copyright © 2015年 liangsicheng. All rights reserved.
//

#import "RecommenCollectionViewCell.h"

@implementation RecommenCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{
    self.cover_image_urlImageView=[[UIImageView alloc]initWithFrame:CGRectMake(self.contentView.frame.origin.x ,self.contentView.frame.origin.y, self.frame.size.width, 160*HEIGHT/667)];
    [self.contentView addSubview:self.cover_image_urlImageView];
    self.nameLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.contentView.frame.origin.x+8*WIDTH/375, self.contentView.frame.origin.y+165*HEIGHT/667, self.frame.size.width-15*WIDTH/375, 55*HEIGHT/667)];
    self.nameLabel.numberOfLines=2;
    [self.contentView addSubview:self.nameLabel];
    self.priceLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.nameLabel.frame.origin.x, self.nameLabel.frame.origin.y+55*HEIGHT/667, 75*WIDTH/375, 35*HEIGHT/667)];
    self.priceLabel.textColor=[UIColor colorWithRed:1.000 green:0.000 blue:0.000 alpha:0.960]
    
    ;
    [self.contentView addSubview:self.priceLabel];
    self.likeImageView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"iconfont-xihuan.png"]];
    self.likeImageView.frame=CGRectMake(self.priceLabel.frame.origin.x+self.priceLabel.frame.size.width+40*WIDTH/375, self.priceLabel.frame.origin.y+10*HEIGHT/667, 15*WIDTH/375, 15*HEIGHT/667);
    [self.contentView addSubview:self.likeImageView];
    
    self.favorites_countLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.likeImageView.frame.origin.x+self.likeImageView.frame.size.width+5*WIDTH/375, self.likeImageView.frame.origin.y, 30*WIDTH/375, 15*HEIGHT/667)];
    [self.contentView addSubview:self.favorites_countLabel];
    self.favorites_countLabel.font=[UIFont systemFontOfSize:10];
    
}
-(void)setModel:(RecommenModel *)model
{
    _model=model;
    [self.cover_image_urlImageView sd_setImageWithURL:[NSURL URLWithString:_model.cover_image_url]];
     self.nameLabel.text=_model.name;
    self.priceLabel.text=[NSString stringWithFormat:@"￥%@",_model.price];
    self.favorites_countLabel.text=[NSString stringWithFormat:@"%ld",_model.favorites_count];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
